home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / Aidan's Class Libraries / Source / Headers / CLBaseWindow.h < prev    next >
Encoding:
Text File  |  1997-07-13  |  2.2 KB  |  88 lines  |  [TEXT/CWIE]

  1. //Copyright (c) 1997 Aidan Cully
  2. //All rights reserved
  3.  
  4. #ifndef _WINDOWTYPES_H
  5. #define _WINDOWTYPES_H
  6.  
  7. #include <windows.h>
  8. #include "CLList.h"
  9. #include "CLDrawSlate.h"
  10. #include "CLMouseListener.h"
  11.  
  12. enum {
  13.     kWindowSuccess = 0,
  14.     kWindowNotInitializedErr = 1,
  15.     kWindowInvalidPartCodeErr = 2,
  16.     kWindowMemErr = 3
  17. };
  18.  
  19. #define wkBaseWindow 0
  20.  
  21. #define kwKillMe -1
  22. #define kKillMainWindow 'KRwt'
  23.  
  24. class TLayoutLeaf;
  25. class TWindowDrawer;
  26. class TWindowLayer;
  27.  
  28. class TBaseWindow:
  29.     public TDrawSlate,
  30.     public MMouseListener
  31. {
  32. private:
  33.     SInt16 mhWinRes;
  34.     GrafPtr mhOldPort;
  35. protected:
  36.     WindowRef mWindow;
  37.     Boolean mOpen, mActive;
  38.     TLayoutLeaf *mContent;
  39.     TList<TWindowDrawer*> mNeedWindowDrawers;
  40.     TWindowLayer *mLayer;
  41.     virtual void DoContentClick( const TMouseButtonEvent* );
  42.     virtual void DoGrow( const TMouseButtonEvent* );
  43.     virtual void DoDrag( const TMouseButtonEvent* );
  44.     virtual void DoZoom( short partCode, const TMouseButtonEvent* );
  45.     virtual SInt8 RespondResizeSelf( const Rect &oldRect, const Rect &newRect );
  46.     virtual Boolean GetDrawSelf();
  47.     virtual Boolean ReleaseDrawSelf();
  48.     virtual void DrawSelf();
  49. public:
  50.     TBaseWindow( SInt16, TWindowLayer*, TLayoutLeaf* );
  51.     Boolean IsOpen();
  52.     WindowRef GetWindow();
  53.     virtual ~TBaseWindow();
  54.     virtual void HandleMouse( TMouseButtonEvent* );
  55.     virtual void DoMouseDown( short, const TMouseButtonEvent* );
  56.     virtual SInt8 DoUpdate();
  57.     virtual SInt8 MakeActive( Boolean );
  58.     virtual SInt8 DoHideWindow();
  59.     virtual SInt8 DoShowWindow();
  60.     virtual SInt8 SetWTitle( const Str255 );
  61.     virtual SInt8 GetWTitle( Str255 );
  62.     virtual SInt8 DoClose();
  63.     virtual SInt8 Init();
  64.     virtual void Draw();
  65.     virtual void LocalToGlobal( Point* );
  66.     virtual void GlobalToLocal( Point* );
  67.     virtual void SelectWindow();
  68.     virtual void ClipAbove( RgnHandle );
  69.     virtual void CalcMouseMove( const Point&, RgnHandle );
  70.     virtual void HandleMouseMoved( TMouseEvent*, bool );
  71.     virtual Boolean IsActive() {return( mActive );};
  72.     virtual void AddDrawer( TWindowDrawer* );
  73. };
  74.  
  75. extern void GetGrowRgn( const Rect &, RgnHandle );
  76. extern void GetWindowDiffRect( WindowRef, Rect * );
  77.  
  78. inline Boolean TBaseWindow::IsOpen()
  79. {
  80.     return( mOpen );
  81. }
  82.  
  83. inline WindowRef TBaseWindow::GetWindow()
  84. {
  85.     return( mWindow );
  86. }
  87.  
  88. #endif